package com.cpj.bsyyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpj.bsyyzx.entity.HealthFile;
import com.cpj.bsyyzx.mapper.HealthFileMapper;
import com.cpj.bsyyzx.service.IHealthFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cpj.bsyyzx.util.CommonResult;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@Service
public class HealthFileServiceImpl extends ServiceImpl<HealthFileMapper, HealthFile> implements IHealthFileService {
//    @Override
//    public IPage<HealthFile> selectPageVo(Page<HealthFile> page, Wrapper<HealthFile> wrapper) {
//        return getBaseMapper().selectPageVo(page, wrapper);
//    }

    @Override
    public boolean add(HealthFile healthFile) {
        QueryWrapper<HealthFile> wrapper = new QueryWrapper<>();
        wrapper.eq("user_name", healthFile.getUserName());

        HealthFile query = this.getOne(wrapper);
        if (query == null)
            return this.save(healthFile);
        return false;

    }

}
